import { defHttp } from '/@/utils/http/axios';

enum Api {
  list = '/jeecg-lab/entrust/labWsuperviseTask/list',
  save = '/jeecg-lab/entrust/labWsuperviseTask/add',
  edit = '/jeecg-lab/entrust/labWsuperviseTask/edit',
  deleteOne = '/jeecg-lab/entrust/labWsuperviseTask/delete',
  submitSupervise = '/entrust/labWsupervise/submitSupervise',
  receiverList = '/sys/user/list'
}
/**
 * 列表接口
 * @param params
 */
export const list = (params) => defHttp.get({ url: Api.list, params });

/**
 * 删除单个
 * @param params
 * @param handleSuccess
 */
export const deleteOne = (params, handleSuccess) => {
  return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
    handleSuccess();
  });
};

/**
 * 保存或者更新
 * @param params
 * @param isUpdate
 */
export const saveOrUpdate = (params, isUpdate) => {
  let url = isUpdate ? Api.edit : Api.save;
  return defHttp.post({ url: url, params }, { isTransformResponse: false });
};

/**
 * 提交监督抽查单
 * @param params
 * @param handleSuccess
 */
export const submitSupervise = (params, handleSuccess) => {
  return defHttp.delete({ url: Api.submitSupervise, params }, { joinParamsToUrl: true }).then(() => {
    handleSuccess();
  });
};
/**
 * 获取接收人员接口
 * @param params
 */
export const getReceiverList = () => defHttp.get({ url: Api.receiverList },{ isTransformResponse: false} );
